﻿using System;
using System.Linq;
using InvestmentIntelligence.DbModel.Models;

namespace InvestmentIntelligence.Data.Repository.EFImplementation
{
    public class LayoutRepository : IIPRepository<Layout>, ILayoutRepository
    {
        public int Create(Layout item)
        {
            Add(item);
            return item.Id;
        }

        public Layout GetLastByUser(int userId)
        {
            return Get(v => v.Where(c => c.UserId == userId).OrderByDescending(c => c.Id).FirstOrDefault());
        }
    }
}
